package org.example.springchatroom.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.springchatroom.model.User;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 九转苍翎
 * Date: 2025/9/3
 * Time: 10:48
 */
@Mapper
public interface UserMapper {

    @Select("select * from user where user_name = #{userName}")
    User login(String userName);

    @Insert("insert into user values (null,#{userName},#{password})")
    Integer register(User user);

    @Select("select * from user where user_id = #{userId}")
    User getUserById(Integer userId);
}
